<template>
  <div class="home">
    <van-search
      v-model="searchValue"
      shape="round"
      background="#4fc08d"
      placeholder="请输入搜索关键词"
    />
    <div class="home-content">
      <van-swipe class="home-banner" :autoplay="3000" lazy-render>
        <van-swipe-item class="home-banner-item" v-for="image in images" :key="image.id">
          <img class="img" :src="image?.imgUrl" />
        </van-swipe-item>
      </van-swipe>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import store from '@/stores'
import { showToast, showNotify } from 'vant'

const { useHomeStore } = store
const homeStore = useHomeStore()

const searchValue = ref()
const images = ref()

const getHomeBanner = async () => {
  const data = await homeStore.getHomeBanner()
  images.value = data
}

onMounted(() => {
  getHomeBanner()
})
</script>

<style scoped lang="scss">
@import './home-style.scss';
</style>
